<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>&lt; 在不在科技 &gt; CMR内部管理系统</title>

    <!-- Bootstrap Core CSS -->
    <link href="<?=base_url('/public/bower_components/bootstrap/dist/css/bootstrap.min.css')?>" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="<?=base_url('public')?>/bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="<?=base_url('public')?>/dist/css/sb-admin-2.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="<?=base_url('public')?>/bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>
    <div class="container">
        <div class="row">
            <div class="col-md-4 col-md-offset-4">
                <div class="login-panel panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title"><?= $_SESSION['conf']['title'] ?></h3>
                    </div>
                    <div class="panel-body">
                        <form name="loginForm" id="login_form" method="post" action="<?=site_url('welcome/login') ?>">
                            <fieldset>
                                <?php if(!empty($_SESSION['err'])):?>
                                <div class="alert alert-danger">
                                    <p class="fa fa-tag"> <?=$_SESSION['err']?> </p>
                                </div>
                                <?php endif;?>
                                <div class="form-group">
                                    <input class="form-control" placeholder="登录帐号/手机/邮箱" name="username" type="text" autofocus>
                                </div>
                                <div class="form-group">
                                    <input class="form-control" placeholder="密码" name="password" type="password" value="">
                                </div>
                                <div class="form-group">
                                    <input class="form-control" placeholder="验证码" name="cap" type="text" value="">
                                </div>
                                <div class="form-group">
                                    <a href="javascript:;" onclick="h_cap()" alt="验证码" title="点击更换验证码" id="cap"><?=$cap['image']?></a>
                                </div>
                                <!-- Change this to a button or input when using this as a form -->
                                <input type="submit" value="登陆" class="btn btn-lg btn-success btn-block">
                                <!-- <a href="index.html" class="btn btn-lg btn-success btn-block">登录</a> -->
                            </fieldset>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- jQuery -->
    <script src="<?=base_url('public')?>/bower_components/jquery/dist/jquery.min.js"></script>

    <script type="text/javascript" src="<?=base_url('public')?>/layer/layer.js"></script>
    <script src="<?=base_url('public')?>/lib/jqusey.form.js"></script>
    <!-- Bootstrap Core JavaScript -->
    <script src="<?=base_url('public')?>/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="<?=base_url('public')?>/bower_components/metisMenu/dist/metisMenu.min.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="<?=base_url('public')?>/dist/js/sb-admin-2.js"></script>

<script type="text/javascript">

    //点击更换验证码
    function h_cap(){
        $.get("<?=site_url('welcome/reset_cap')?>",function(data){
            $("#cap").html(data);
        });
    }

    $('#login_form').submit(function() {
        var index = layer.load(2);
        $(this).ajaxSubmit(function(data){
            layer.close(index);
            if(data == 1){
                location.href="<?php site_url('home/index')?>";
            }else{
                h_cap();
                layer.alert(data,{
                    icon:2,
                });
            }
        })
        return false;
    })
</script>
</body>

</html>
